package org.example.code.test2025.one_month;

import java.util.ArrayList;
import java.util.List;

/**
 * @Title: test0107
 * @Author yxy
 * @Package org.example.code.test2025.one_month
 * @Date 2025/1/7 15:22
 * @description:
 */
public class test0107 {

    public String largestGoodInteger(String num) {
        int i = 1, k = 1;
        String res = "";
        if (num.length() < 3) {
            return res;
        }
        char t = num.charAt(0);
        while (i < num.length()) {
            char c = num.charAt(i);
            if (c == t) {
                k++;
            } else {
                t = c;
                k = 1;
            }
            if (k == 3) {
                if (res.isEmpty() || res.charAt(0) < t) {
                    res = String.valueOf(t) + t + t;
                }
            }
            i++;
        }
        return res;
    }

    public static void main(String[] args) {
        String str = "3200014888";
        test0107 l = new test0107();
        System.out.println(l.largestGoodInteger(str));
    }
}
